<?php


namespace App\Admin\Controllers\Config;


use App\Admin\Forms\Config\AppConfig;
use App\Admin\Forms\Config\LinkConfig;
use App\Admin\Forms\Config\ProtocolConfig;
use App\Admin\Forms\Config\SeoConfig;
use App\Admin\Forms\Config\SiteConfig;
use App\Admin\Forms\Config\SocialConfig;
use App\Admin\Forms\Config\StorageConfig;
use App\Admin\Forms\Config\SmtpConfig;
use App\Http\Controllers\Controller;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Widgets\Tab;

class AppController extends Controller
{
    public function index(Content $content)
    {
        $tab = Tab::make();
        $config = [
            "app" => AppConfig::class,
            "storage" => StorageConfig::class,
            "mailer" => SmtpConfig::class,
        ];
        $type = request('_t', 'app');
        foreach ($config as $k => $v) {
            $name = trans(sprintf('admin.config.%s',$k));
            $type == $k ? $tab->add($name,new $v,true) :  $tab->addLink($name,request()->fullUrlWithQuery(["_t"=>$k]));
        }
        return $content->header(trans('admin.config.site'))->translation("admin")->body($tab->withCard()) ;
    }

}
